@echo off
echo Starting Protocol Buffers compilation...

set PROTOC_PATH=protoc

set OUTPUT_DIR=generated

if not exist "%OUTPUT_DIR%" mkdir "%OUTPUT_DIR%"

for %%f in (*.proto) do (
    echo Compiling %%f...
    "%PROTOC_PATH%" --cpp_out="%OUTPUT_DIR%" "%%f"
    if errorlevel 1 (
        echo Error compiling %%f
        pause
        exit /b 1
    )
)

echo All .proto files compiled successfully!
echo Generated files are in the "%OUTPUT_DIR%" folder.
pause